package com.liao.r2dbc.dao.impl;

import com.liao.r2dbc.dao.CustomUserDao;
import com.liao.r2dbc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class CustomUserDaoImpl implements CustomUserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public List<User> myFindAll() {
        return this.jdbcTemplate.query("select * from user",new Object[]{},new BeanPropertyRowMapper<>(User.class));
    }
}
